home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / Pascal / Skel 3.0i / Skel resize.p < prev    next >
Text File  |  1994-04-12  |  1KB  |  43 lines

  1. unit ReSize;
  2.  
  3. interface
  4.  
  5.     uses
  6.         Globals;
  7.  
  8.     procedure ReSize (a_window: WindowPtr; downpt: Point);
  9.  
  10. implementation
  11.  
  12. {Change the size of the given window}
  13. {############################   ReSize   ###############################}
  14.  
  15. {  Called on a mouse-down in the grow box, this allows the user to change}
  16. {  the size of the window.  We change the size, then}
  17. {  claim that the whole of the window contents is no longer validly drawn,}
  18. {  because we're too lazy to do so for just the scroll bar regions}
  19. {  that are actually subject to change.  See the Window Manager.}
  20.  
  21.     procedure ReSize (a_window: WindowPtr; downpt: Point);
  22.         var
  23.             w, h: Integer;            (* new width and height of the sized window *)
  24.             newsize: LongInt;        (* the new size *)
  25.     begin
  26.  
  27.         newsize := GrowWindow(a_window, downpt, growrect);
  28.  (* find new size *)
  29.         w := LoWord(newsize);    (* find the width *)
  30.         h := HiWord(newsize);    (* find the height *)
  31.  
  32.         SizeWindow(a_window, w, h, true);(* change to the new window size *)
  33.  
  34. {  place whole window into update Region to be sure it all gets}
  35. {  updated. This is more than is strictly necessary, but a lot}
  36. {  easier than just invalidating the regions that actually may have}
  37. {  changed.}
  38.  
  39.         InvalRect(a_window^.portRect);
  40.  
  41.     end;                (* ReSize *)
  42.  
  43. end.